<template>
  <div>
    <p>
      <input v-model="info.name" type="text" />
    </p>
    <p>
      <input v-model="info.text" type="text" />
    </p>
    <p>
      <button @click="pub">发布</button>
    </p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      info: {
        name: "",
        text: "",
      },
    };
  },
  methods: {
    pub() {
      // let date = new Date()
      // this.info.date = date.getTime()
      let date = new Date();
      date = date.getTime()
      //   this.$set  让数据变成响应式
      this.$set(this.info, "date", date)

      console.log(this.info);
      // 发送
      this.$bus.$emit("sendInfo", JSON.parse(JSON.stringify(this.info)));
    },
  },
};
</script>

<style>
</style>